<template>
	<view>
		<view class="bj">
			<u-navbar title="消息" :autoBack="true" bgColor="#3284fc"
				titleStyle="font-size:18px; color:white;height:44px;line-height:44px" leftIconColor="#fff">
			</u-navbar>
			<u-cell-group :border="false"
				:customStyle="{backgroundColor:'#ffffff',borderRadius:'10px',margin:'50px auto',width:'350px'}">
				<view v-for="(item,index) in messageList" :key="index">
					<u-cell :title="item.title" :label="item.content" titleStyle="font-weight:500;font-size:16px">
						<template v-slot:value>
							<span style="margin-top: -20px; font-size:13px; color: #9A9A9A;">{{item.createTime}}</span>
						</template>
					</u-cell>
				</view>
				
			</u-cell-group>




		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				messageList:[]
			}
		},
		onLoad() {
			this.getMessageList()
		},
		methods: {
			getCookie(name) {
				const nameEQ = name + "=";
				const cookies = document.cookie.split(';');
				for (let i = 0; i < cookies.length; i++) {
					let c = cookies[i].trim();
					if (c.indexOf(nameEQ) === 0) {
						return decodeURIComponent(c.substring(nameEQ.length));
					}
				}
				return null;
			},
			getMessageList() {
				let that = this;
				this.$http({
					url:'/api/user/message/aa/'+that.getCookie('userid'),
					method:"GET",
					success(res){
						// console.log(res)
						that.messageList=res.data
						// console.log(res.data)
						
					}
				})
			}
		}
	}
</script>

<style scoped>
	.bj {
		width: 100%;
		height: 220px;
		background-color: #3384fc;
	}
</style>